package cn.xshi.sys.service.impl;
import java.util.List;
import java.util.Map;
import cn.xshi.sys.dao.SysNoticeDao;
import cn.xshi.sys.form.SysNoticeForm;
import cn.xshi.sys.model.SysNotice;
import cn.xshi.sys.service.SysNoticeService;
import org.springframework.stereotype.Service;
import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import javax.annotation.Resource;
/**
 * @Desc 平台公告
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service
public class SysNoticeServiceImpl extends BaseService implements SysNoticeService {

	@Resource
	private SysNoticeDao sysNoticeDao;

	/**
	 * 分页
	 * @param sysNoticeForm
	 * @return
	 */
	public List<SysNotice> getSysNoticeListByCondition(SysNoticeForm sysNoticeForm){
		try{
			return sysNoticeDao.getSysNoticeListByCondition(sysNoticeForm);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 查询对象
	 * @param id
	 * @return
	 */
	public SysNotice getSysNoticeById(String id){
		try{
			return sysNoticeDao.getSysNoticeById(id);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 添加
	 * @param sysNotice
	 * @return
	 */
	public int addSysNotice(SysNotice sysNotice){
		int i = 0;
		try {
			i = sysNoticeDao.addSysNotice(sysNotice);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改
	 * @param sysNotice
	 * @return
	 */
	public int updateSysNotice(SysNotice sysNotice){
		int i = 0;
		try {
			i = sysNoticeDao.updateSysNotice(sysNotice);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 删除
	 * @param condition
	 * @return
	 */
	public int delSysNotice(Map<String,Object> condition){
		int i = 0;
		try {
			i = sysNoticeDao.delSysNotice(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 统计
	 * @param condition
	 * @return
	 */
	public int getSysNoticeCountByCondition(Map<String,Object> condition){
		try{
			return sysNoticeDao.getSysNoticeCountByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}
}
